﻿
@{
    ViewData["Title"] = "存储方式";
    Layout = "~/Views/Shared/_Layout.cshtml";
}

<div id="appStorage">
    <el-container style="margin:2px;padding:2px;">
        <el-table :data="tableData"
                  border
                  style="width: 100%">
            <el-table-column prop="code"
                             label="存储方式编码"
                             width="180">
            </el-table-column>
            <el-table-column prop="name"
                             label="存储方式名称"
                             width="180">
            </el-table-column>
            <el-table-column fixed="right" label="操作" width="250" align="center">
                <template slot-scope="scope">
                    <el-button type="primary" size="small" v-if="scope.row.code=='sharefolder'" @@click="setStorage(scope.row)">设置</el-button>
                </template>
            </el-table-column>
        </el-table>
    </el-container>
</div>


<style>
    .el-table .warning-row {
        background: oldlace;
    }

    .el-table .success-row {
        background: #f0f9eb;
    }
</style>
<script>
    function refreshFromChild() {
        vueEnv.GetEnvList();
    }

    var vueEnv = new Vue({
        el: '#appStorage',
        data() {
            return {
                tableData: [{
                    code: 'sharefolder',
                    name: '共享文件夹'
                },
                {
                    code: 'mysql',
                    name: 'mysql数据库'
                }]
            }
        },
        created() {
            var _this = this;
            window.addEventListener("resize", function () {
                _this.tableStyle = getTableStyle();
            });
        },
        methods: {
            setStorage(row) {
                var code = "";
                if (row) code = row.code;
                this.$addTab(code, "存储设置", "../Storage/Settings?code=" + code);
            },

            tableRowClassName({ row, rowIndex }) {
                if (rowIndex === 1) {
                    return 'warning-row';
                } else if (rowIndex === 3) {
                    return 'success-row';
                }
                return '';
            }
        }
    });
</script>